<?php

class FeedbackForm extends BaseForm
{
  public function configure()
  {
    
    ProjectConfiguration::getApplicationConfiguration('front', 'dev', true)->loadHelpers('I18N');

    $this->setWidgets(array(
      'name'    => new sfWidgetFormInputText(array(), array('style'=>'width:300px;font-size:1em;', 'class'=>'flexInputSimple')),
      'email'   => new sfWidgetFormInputText(array(), array('style'=>'width:300px;font-size:1em;', 'class'=>'flexInputSimple')),
      'message'    => new sfWidgetFormTextarea(array(), array('style'=>'width:300px;height:150px;font-size:1em;', 'class'=>'flexInputSimple'))
    ));
    $this->widgetSchema['captcha'] = new sfWidgetFormInputText(array(), array('style'=>'width:125px!important;margin-top:2px;font-size:1em;','class'=>'flexInputSimple'));

    
    
    $required = __('Required.');
    $this->setValidators(array(
      'name'    => new sfValidatorString(array('required' => true), array('required' => $required)),
      'email'   => new sfValidatorEmail(array('required' => true), array('required' => $required,'invalid'=>__('Invalid email.'))),
      'message'    => new sfValidatorString(array('required' => true), array('required' => $required)),
    )); 
    $this->validatorSchema['captcha']          = new sfValidatorSfCryptoCaptcha(array('required' => true, 'trim' => true),
                                                   array('wrong_captcha' => __('The code you copied is not valid.'),
                                                         'required' => __('You did not copy any code. Please copy the code.')));

    
    $this->widgetSchema->setLabels(array(
      'name'    => __('Name'),
      'email'   => __('Email'),
      'message' => __('Message'),
    )); 
    $this->widgetSchema->setLabel('captcha', __('Please copy the').'<br/>'.__('security code'));
    
    
    $this->widgetSchema->setNameFormat('feedback[%s]');
  }


}